/*
 * @Author: szx
 * @Date: 2021-11-23 13:19:03
 * @LastEditTime: 2021-11-23 13:50:29
 * @Description:
 * @FilePath: \leetcode\1-99\55\55.js
 */
/**
 * @param {number[]} nums
 * @return {boolean}
 */
var canJump = function (nums) {
    const n = nums.length;
    let dp = 0;
    for (let i = 0; i < n; i++) {
        if (dp < i) return false;
        dp = Math.max(dp, nums[i] + i);
    }
    return true;
};
console.log(canJump([2, 0, 0]));
